

class R(object):
    def __init__(self):
        self.code = 200
        self.message = 'success'

    def ok(self):
        return self.result()

    def ok1(self, msg):
        self.message = msg
        return self.result()

    def ok2(self, msg, data):
        self.message = msg
        rst = self.result()
        rst.update(data)
        return rst

    def error(self, msg):
        return self.error2(500, msg)

    def error2(self, code, msg):
        self.code = code
        self.message = msg
        return self.result()

    def result(self):
        return {'code': self.code, 'message': self.message}